/**
* 基础菜单 商品管理
*/
<template>
  <div>

    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>目录管理</el-breadcrumb-item>
    </el-breadcrumb>

    <video-list v-on:onRowEditClick="onRowEditClick"
                        @setMainLoadingFalse="isMainListLoading=false"
                        :subjectList.sync = "subjectList"
                        :isMainListLoading.sync="isMainListLoading"></video-list>

  <video-edit :dialogVisible.sync="editFormVisible"
                      :rowData.sync="editForm"
                      :categoryList.sync="categoryList"
                      :subjectList.sync = "subjectList"
                      @onDialogClose="onEditDialogClosed"
  ></video-edit>

  </div>
</template>

<script>
    import videoEdit from "./Edit";
    import videoList from "./List"
    import axios from "axios"
    import {localApi} from "../../api/baseApi";

    export default {
        components: {
            videoList,
            videoEdit
        },
        data() {
            return {
                isMainListLoading: false, //是显示加载
                editFormVisible: false, //控制编辑页面显示与隐藏
                title: '添加',
                editForm: Object,
                subjectList:[],
                categoryList:[]
            }
        },
        mounted(){
          this.getCategoryList();
          this.getSubjectList();
        },
        methods: {
            //显示编辑界面
            onRowEditClick: function(row) {
                if (row!=null && row != undefined) {
                    this.editForm = row;
                } else {
                    this.editForm = {};
                }
                this.editFormVisible = true;
            },
            onEditDialogClosed:function(saveOrNot){
              this.editFormVisible = false;
              if(saveOrNot){
                  this.isMainListLoading = true;
              }
            },
            getSubjectList(){
                var that = this;
                axios.get(localApi+"o/defaultSubjectSet")
                    .then(res => {
                        console.log("subjectList",res);
                        if(res.data.code==1){
                            that.subjectList = res.data.result;
                            that.categoryList = res.data.result;
                        }
                });
            },
            //获取栏目列表
            getCategoryList(){

            }
        }
    }
</script>

